/**
 *
 * @Title: CommonActivity.java
 * @Package com.idrem.views.bf
 * @Description: TODO(用一句话描述该文件做什么)
 * @author WangZhengCai
 * @date 2012 2012-11-13 下午8:07:59
 * @version V1.0
 *
 */
package com.idrem.views.bf;

import android.app.AlertDialog;
import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Handler;
import android.widget.ListView;
import android.widget.TextView;

/**
 * 
 * @ClassName: CommonActivity
 * @Description: 继承此Activity类可以使用此类的方法
 *               该类是提供整个项目中Activity所使用到的公共方法.该类中全属于公共方法.集成该类可以使用
 * @author WangZhengCai
 * @date 2012 2012-11-13 下午8:07:59
 * 
 * 
 */
public class CommonActivity extends ListActivity implements Runnable {

	public Intent intent = new Intent();

	/** ==============BEGAN进度条管理(ProgressDialog)============= **/
	public ProgressDialog progressDialog = null;
	public Handler handler = new Handler();
	private int i = 0;
	/** ==============END进度条管理(ProgressDialog)============= **/

	public ListView listViewAll = null;
	public TextView textViewTitle = null;

	/**
	 * 退出
	 */
	private void openQiutDialog() {
		new AlertDialog.Builder(this).setTitle("iDREM")
				.setMessage("是否退出iDREM系统？")
				.setPositiveButton("确定", new DialogInterface.OnClickListener() {

					@Override
					public void onClick(DialogInterface dialog, int which) {
						finish();
					}
				})
				.setNegativeButton("取消", new DialogInterface.OnClickListener() {

					@Override
					public void onClick(DialogInterface dialog, int which) {

					}
				}).show();
	}

	/**
	 * 调用该CommonActivity类的线程
	 */
	public void run() {

		try {
			Thread.sleep(50);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		if (i > 500) {
			progressDialog.dismiss();
			handler.removeCallbacks(this);
		} else {
			i = i + 10;
			handler.post(this);
		}

	}
}
